/*******************************************************************************
* This file provides the API for BMP085 pressure sensor.
*
* Author: Kong Wai Weng
* Email:  waiweng83@gmail.com
*******************************************************************************/



#ifndef _HAL_BMP085_H
#define _HAL_BMP085_H



#include <math.h>
#include "hal_i2c.h"
#include "variables.h"
#include "task.h"



/*******************************************************************************
* STRUCTURE AND UNION DEFINITION                                               *
*******************************************************************************/



/*******************************************************************************
* PUBLIC FUNCTION PROTOTYPES                                                   *
*******************************************************************************/

/*******************************************************************************
* PUBLIC FUNCTION: vInitBmp085
*
* PARAMETERS:
* ~ void
*
* RETURN:
* ~ void
*
* DESCRIPTIONS:
* Initialize the BMP085 pressure sensor.
* This function must be called after the I2C 1 has been initialized.
*
*******************************************************************************/
void vInitBmp085(void);



/*******************************************************************************
* PUBLIC FUNCTION: fGetTemperature
*
* PARAMETERS:
* ~ void
*
* RETURN:
* ~ Temperature (Unit = degree celcius).
*
* DESCRIPTIONS:
* Read the calculated temperature.
*
*******************************************************************************/
float fGetTemperature(void);



/*******************************************************************************
* PUBLIC FUNCTION: fGetAbsolutePressure
*
* PARAMETERS:
* ~ void
*
* RETURN:
* ~ Absolute pressure (Unit = Pa).
*
* DESCRIPTIONS:
* Read the calculated absolute pressure.
*
*******************************************************************************/
float fGetAbsolutePressure(void);



/*******************************************************************************
* PUBLIC FUNCTION: fGetPressureAltitude
*
* PARAMETERS:
* ~ void
*
* RETURN:
* ~ Altitude in m.
*
* DESCRIPTIONS:
* Read the calculated pressure altitude.
*
*******************************************************************************/
float fGetPressureAltitude(void);



/*******************************************************************************
* TASK: taskBmp085Loop
*
* DESCRIPTIONS:
* This task is the main loop to read the data from the BMP085 pressure sensor.
* The temperature will be read once every 3 pressure data being read.
*
*******************************************************************************/
portTASK_FUNCTION_PROTO(taskBmp085Loop, pvParameters);



#endif
